package 代码记录.Bit48天集训;

import java.util.Arrays;
import java.util.Scanner;

/**1.数据库连接池
 * 2.mkdir
 * @author zx
 * @create 2022-06-26 20:10
 */
public class day_37 {
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            sc.nextLine();
            int size = 0;
            int res = 0;
            String[] arr = new String[n];
            for(int i = 0;i < n;i++){
                arr[i] = sc.nextLine();
            }
            for(int i = 0;i < n;i++){
                String[] str = arr[i].split(" ");
                String id = str[0];
                String s = str[1];
                if(s.equals("connect")){
                    size++;
                    res = Math.max(res,size);
                }else if(s.equals("disconnect")){
                    size--;
                }
            }
            System.out.println(res);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            sc.nextLine();
            String[] str = new String[n];
            for(int i = 0;i < n;i++){
                str[i] = sc.nextLine();
            }
            Arrays.sort(str);// 排序以达到按照字典顺序
            for(int i = 1; i < n; i++){
                // 排完序后最接近的字符串就会相邻
                // 若后者是在前者的路径之后延伸(即为/a/ab和/a/ab/abc的关系)
                // 就将前者变为""以便后续打印时判断,需要注意(/a/ab和/a/abc)这种情况
                if(str[i].contains(str[i - 1]) && str[i].charAt(str[i - 1].length()) == '/'){
                    str[i - 1] = "";
                }
            }
            for(int i = 0; i < n; i++){
                if(!str[i].equals("")){
                    System.out.println("mkdir -p "+str[i]);
                }
            }
            System.out.println();
        }
    }
}
